Skip to content

Conversation

jnoordsij
Copy link
Contributor

@jnoordsij jnoordsij commented Jul 24, 2025

When browsing through the docs I encountered an example, which can probably enhanced by using await using given that all respective classes from this package implement the AsyncDisposable method.

After further inspection, there seemed to be more examples where this would be preferable. I've attempted to update all examples where async context is clear and this thus should be preferable.

@jnoordsij
Copy link
Contributor Author

Further examples have been updated; this should be ready to review now.

Copy link
Member

@bgrainger bgrainger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The await using MySqlCommand is a bit overkill, as DisposeAsync is just a synchronous method that sets m_isDisposed = true. However, the compiler should handle a completed ValueTask efficiently, and it means client code doesn't have to be dependent on those internal details (which might change).

@bgrainger bgrainger merged commit 84197e5 into mysql-net:master Aug 30, 2025
21 checks passed
bgrainger added a commit that referenced this pull request Aug 30, 2025
This is a follow-up to #1580 that updates the source of the Markdown docs.
@jnoordsij jnoordsij deleted the patch-1 branch August 30, 2025 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants